<?php
/**
 * Created by PhpStorm.
 * User: cc
 * Date: 2022/2/8
 * Time: 11:43 上午
 */

namespace app\api\controller\v30;

use app\api\controller\v13\Auth2;
use app\common\cachemodel\live\LiveAnswerAstroRecord;
use app\common\cachemodel\live\LiveAnswerDiceRecord;
use app\common\cachemodel\live\LiveAnswerTarotRecord;

/**
 * Class LiveAnswerInfo
 * @package app\api\controller\v30
 */
class LiveAnswerInfo extends Auth2
{
    /**
     * 获取互动信息
     * @return \think\response\Json
     * @throws \Exception
     */
    public function answerInteractionInfo()
    {
        $liveRecordId = input('live_record_id/d', 0);
        if ($this->user['id'])
        {
            $uid = $this->user['id'];
        } else
        {
            $uid = 0;
        }
        $res[] = (new LiveAnswerAstroRecord())->getUserAnswerProgressInfo($uid, $liveRecordId, 0);
        $res[] = (new LiveAnswerDiceRecord())->getUserAnswerProgressInfo($uid, $liveRecordId, 0);
        $res[] = (new LiveAnswerTarotRecord())->getUserAnswerProgressInfo($uid, $liveRecordId, 0);
        return show(config('code.success'), '获取成功', $res);
    }

    /**
     * 获取取消原因列表
     * @return \think\response\Json
     */
    public function getCancelList()
    {
        $data = config('live_app.user_cancel_list');
        return show(config('code.success'), '获取成功', array_values($data));
    }
}
